using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using net_work.Data.Entity.Cam;

namespace net_work.Config.DataBaseConfig.Cam;

/// <summary>
/// 审批申请实体配置类
/// </summary>
public class ApplyEntityTypeConfiguration : IEntityTypeConfiguration<Apply>
{
    public void Configure(EntityTypeBuilder<Apply> builder)
    {
        builder.ToTable("cam_apply");

        builder.HasKey(a => a.Id);

        // 配置字段名映射
        builder.Property(a => a.Id).HasColumnName("apply_id");
        builder.Property(a => a.Content).HasColumnName("apply_cnt").IsRequired().HasMaxLength(1024);
        builder.Property(a => a.UserId).HasColumnName("apply_user_id").IsRequired();

        builder.Property(a => a.CreatedBy).HasColumnName("create_by").IsRequired().HasMaxLength(64);
        builder.Property(a => a.CreatedTime).HasColumnName("create_time").IsRequired();
        builder.Property(a => a.UpdatedBy).HasColumnName("update_by").IsRequired().HasMaxLength(64);
        builder.Property(a => a.UpdatedTime).HasColumnName("update_time").IsRequired();
        builder.Property(a => a.Remark).HasColumnName("remark").HasMaxLength(256);
        builder.Property(a => a.DelFlag).HasColumnName("del_flag").HasDefaultValue('0');
    }
}